package com.addremoveitemtest;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;

import java.util.ArrayList;

/**
 * Created by hasee on 2017/3/30.
 */

public class PageAdapter extends FragmentStatePagerAdapter {
    private Context context;
    private String[] title;
    private ItemFragment[] ItemFragments;

    public PageAdapter(FragmentManager fm) {
        super(fm);
    }

    public PageAdapter(FragmentManager fm, Context context, String[] title, ItemFragment[] itemFragments) {
        super(fm);
        this.context = context;
        this.title = title;
        ItemFragments = itemFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return ItemFragments[position];
    }

    @Override
    public int getCount() {
        return ItemFragments.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
